package com.jsj.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

@Component
public class Problem {
    private int id;
    @NotBlank(message = "题目不能为空")
    @Size(min = 0, max = 9000, message = "题目长度不能超过9000个字符")
    private String title;
    private int labelId;
    private String creator;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date createTime;
    private Label label;
    private int topicId;
    private int score;
    private Number number;
    public Problem() {
    }

    public Problem(int id, @NotBlank(message = "题目不能为空") @Size(min = 0, max = 9000, message = "题目长度不能超过9000个字符") String title, int labelId, String creator, Date createTime, Label label, int topicId, int score,Number number) {
        this.id = id;
        this.title = title;
        this.labelId = labelId;
        this.creator = creator;
        this.createTime = createTime;
        this.label = label;
        this.topicId = topicId;
        this.score = score;
        this.number = number;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getLabelId() {
        return labelId;
    }

    public void setLabelId(int labelId) {
        this.labelId = labelId;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Label getLabel() {
        return label;
    }

    public void setLabel(Label label) {
        this.label = label;
    }

    public Number getNumber() {
        return number;
    }

    public void setNumber(Number number) {
        this.number = number;
    }

    public int getTopicId() {
        return topicId;
    }

    public void setTopicId(int topicId) {
        this.topicId = topicId;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "Problem{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", labelId=" + labelId +
                ", creator='" + creator + '\'' +
                ", createTime=" + createTime +
                ", label=" + label +
                ", number=" + number +
                ", topicId=" + topicId +
                ", score=" + score +
                '}';
    }
}
